﻿using Microsoft.AspNetCore.Http;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;

namespace Tauren.Business.Infrastructure.Globals
{
    public class ConnectionDLLBase : ConnectionBase, IConnectionDLLBase
    {
        public ConnectionDLLBase(IHttpContextAccessor httpContext, IDbConnection dbConnection, Microsoft.Extensions.Configuration.IConfiguration _Configuration) : base(httpContext, _Configuration)
        {
            if (!(Global is null))
            {
                _BusinessConnection = new MySqlConnection(Global.BasicDataConnection);
                _FlowConnection = new MySqlConnection(Global.FlowConnection);
            }
            _MainConnection = dbConnection;

        }
        /// <summary>
        /// 存租户信息的数据库
        /// </summary>
        private IDbConnection _MainConnection;
        public IDbConnection MainConnection { get => _MainConnection; }
        /// <summary>
        /// 业务数据库链接
        /// </summary>
        private IDbConnection _BusinessConnection;
        public IDbConnection BusinessConnection { get => _BusinessConnection; }
        /// <summary>
        /// 业务数据库链接
        /// </summary>
        private IDbConnection _FlowConnection;
        public IDbConnection FlowConnection { get => _FlowConnection; }

    }
}
